  <template>
  <div class="modal-mask" :v-if="flag">
    <div class="modal-container">
      <div class="modal-header">
        <h3>就诊记录详情</h3>
        <span @click="btn" class="close-btn">X</span>
      </div>
      <div class="modal-body" v-for="item in arr" :key="item.data">
        <p><strong>就诊日期：</strong>{{ item.date }}</p>
        <p><strong>医生姓名：</strong>{{ item.doctor }}</p>
        <p><strong>诊断结果：</strong>{{ item.diagnosis }}</p>
        <p><strong>处方信息：</strong>{{ item.prescription }}</p>
      </div>
    </div>
  </div>
</template>
  <script>
export default {
  name: '',
  props: {
    list: {
      type: Array
    },
    flag: {
      type: Boolean
    }
    ,
    dcname: {
      type: String
    }

  },
  data () {
    return {
      arr: []
    }
  },
  created () {

    console.log(this.dcname);
    let obj = this.list.find(item => item.doctor === this.dcname)
    this.arr.push(obj)
    console.log(this.arr);
  },
  computed: {
  },
  methods: {
    btn () {
      // console.log(this.flag);
      this.$emit('update:flag', false)
    }

  }
}
  </script>


  <style scoped>
.hidden {
  display: none !important;
}
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-container {
  background-color: #fff;
  border-radius: 5px;
  padding: 20px;
  max-width: 500px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.close-btn {
  cursor: pointer;
}
</style>


